#include <bits/stdc++.h>
#define int long long
#define N 200010
using namespace std;
int n, a[N], st[N], top, l[N], r[N], sum[N];
signed main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    cin >> a[i], l[i] = 1, r[i] = n;
  for (int i = 1; i <= n; i++) {
    while (top && a[st[top]] < a[i])
      r[st[top--]] = i - 1;
    st[++top] = i;
  }
  top = 0;
  for (int i = n; i; i--) {
    while (top && a[st[top]] <= a[i])
      l[st[top--]] = i + 1;
    st[++top] = i;
  }
  for (int i = 1; i <= n; i++) {
    int siz = r[i] - l[i] + 1, len = min(i - l[i], r[i] - i) + 1;
    sum[1] += a[i], sum[len + 1] -= a[i];
    sum[siz - len + 2] -= a[i], sum[siz + 2] += a[i];
  }
  for (int i = 1; i <= 2; i++)
    for (int j = 1; j <= n; j++)
      sum[j] += sum[j - 1];
  for (int i = 1; i <= n; i++)
    cout << sum[i] << "\n";
  return 0;
}